package pt.ipp.estgf.metreologiatp;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity implements OnClickListener {
	private Button bt_localizacao;
	private Context context;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		bt_localizacao = (Button) findViewById(R.id.btn_localizacao);
		bt_localizacao.setOnClickListener(this);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public void onClick(View v) {

		switch (v.getId()) {
		case R.id.btn_localizacao:

			CharSequence text = "Hello toast!";
			int duration = Toast.LENGTH_SHORT;
			context = getApplicationContext();
			Toast toast = Toast.makeText(context, text, duration);
			toast.show();
			Intent mintent = new Intent(getApplicationContext(),
					localizacao.class);
			startActivity(mintent);

			break;

		}
	}
}
